<HTML><HEAD><TITLE>oriented_graph(+UndirectedGraph, ?DirectedGraph)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(grasper)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>oriented_graph(+UndirectedGraph, ?DirectedGraph)</H1>
Obtains an oriented graph of a given undirected graph.
<DL>
<DT><EM>UndirectedGraph</EM></DT>
<DD>An undirected graph.
</DD>
<DT><EM>DirectedGraph</EM></DT>
<DD>The oriented directed graph of UndirectedGraph.
</DD>
</DL>
<H2>Description</H2>
Obtains an oriented graph of a given undirected graph.
<H3>Fail Conditions</H3>
Fails 
			 if UndirectedGraph is not an undirected graph variable or
			 if UndirectedGraph can not be contrained to have DirectedGraph as an oriented graph (DirectedGraph is a directed graph variable).
			
<H2>Examples</H2>
<PRE>
?- oriented_graph(UG,DG).
No.

?- V`::[]..[1,2,3], DE`::[[3,1]]..[[1,2],[2,3],[3,1]], UE`::[]..[[1,2],[2,1],[2,3],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), oriented_graph(UG,DG).
No.

?- undirgraph(UG,[1,2,3],[[1,2],[2,1]]), oriented_graph(UG,DG), graph_labeling(DG).
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[2, 1]])
Yes ? ;

UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[1, 2]])
Yes ? ;

UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
DG = dirgraph([1, 2, 3], [[1, 2], [2, 1]])
Yes

?- V`::[]..[1,2,3], DE`::[]..[[1,2],[3,1]], UE`::[]..[[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]], dirgraph(DG,V,DE), undirgraph(UG,V,UE), oriented_graph(UG,DG), size(DG,Size), Size #&gt; 0, graph_labeling(DG).
V = [1, 3]
DE = [[3, 1]]
UE = [[1, 3], [3, 1]]
DG = dirgraph([1, 3], [[3, 1]])
UG = undirgraph([1, 3], [[1, 3], [3, 1]])
Size = 1
Yes ? ;

V = [1, 2]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2], [[1, 2]])
UG = undirgraph([1, 2], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[3, 1]]
UE = [[1, 3], [3, 1]]
DG = dirgraph([1, 2, 3], [[3, 1]])
UG = undirgraph([1, 2, 3], [[1, 3], [3, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2]]
UE = [[1, 2], [2, 1]]
DG = dirgraph([1, 2, 3], [[1, 2]])
UG = undirgraph([1, 2, 3], [[1, 2], [2, 1]])
Size = 1
Yes ? ;

V = [1, 2, 3]
DE = [[1, 2], [3, 1]]
UE = [[1, 2], [1, 3], [2, 1], [3, 1]]
DG = dirgraph([1, 2, 3], [[1, 2], [3, 1]])
UG = undirgraph([1, 2, 3], [[1, 2], [1, 3], [2, 1], [3, 1]])
Size = 2
Yes
			</PRE>

</BODY></HTML>
